//
//  SeeSeeBindPhoneController.swift
//  maopu
//
//  Created by huazi on 2017/5/1.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class SeeSeeBindPhoneController: BaseViewController {
    fileprivate var btnPop: UIButton!
    fileprivate var labelPhone: UILabel!
    fileprivate var textFieldCheckCode: UITextField!
    fileprivate var btnGetCheckCode: UIButton!
    fileprivate var btnComplete: UIButton!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.initView()
        // Do any additional setup after loading the view.
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destinationViewController.
     // Pass the selected object to the new view controller.
     }
     */
    fileprivate func initView() {
        self.btnPop = UIButton.init(frame: CGRect.init(x: 0, y: 20, width: 44, height: 44))
        self.btnPop.setImage(UIImage.init(named: "back"), for: .normal)
        self.btnPop.addTarget(self, action: #selector(self.goBack), for: .touchUpInside)
        self.view.addSubview(self.btnPop)
        
        var top: CGFloat = 80.0
        let left: CGFloat = 15.0
        let btnHeight: CGFloat = 40.0
        
        let labelTitle: UILabel = UILabel.init(frame: CGRect.init(x: 0, y: top, width: AppWidth, height: 30))
        labelTitle.text = "绑定手机"
        labelTitle.textAlignment = .center
        labelTitle.font = UIFont.LightDefaultFont(20.0)
        self.view.addSubview(labelTitle)
        top += 30+20
        
        self.labelPhone = UILabel.init(frame: CGRect.init(x: 0, y: top, width: AppWidth, height: 20))
        self.labelPhone.font = UIFont.LightDefaultFont(13.0)
        self.labelPhone.textColor = UIColor.m_textLightColor()
        self.labelPhone.textAlignment = .center
        self.labelPhone.text = "为了安全起见，我们会向您的手机发送短信验证码"
        self.view.addSubview(self.labelPhone)
        top += 20+40
        
        self.textFieldCheckCode = UITextField.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: 40.0))
        self.textFieldCheckCode.placeholder = "请输入验证码"
        self.textFieldCheckCode.font = UIFont.LightDefaultFont(13.0)
        self.view.addSubview(self.textFieldCheckCode)
        top += 40.0
        
        self.btnGetCheckCode = UIButton.init(frame: CGRect.init(x: AppWidth - left - 80.0, y: top - 40.0, width: 80.0, height: 40.0))
        self.btnGetCheckCode.setTitle("获取验证码", for: .normal)
        self.btnGetCheckCode.titleLabel?.font = UIFont.LightDefaultFont(13.0)
        self.btnGetCheckCode.setTitleColor(UIColor.black, for: .normal)
        self.view.addSubview(self.btnGetCheckCode)
        
        let viewLine: UIView = UIView.init(frame: CGRect.init(x: left, y: top , width: AppWidth - 2*left, height: 0.5))
        viewLine.backgroundColor = UIColor.gray
        self.view.addSubview(viewLine)
        top += 30.0
        
        self.btnComplete = UIButton.init(frame: CGRect.init(x: left, y: top, width: AppWidth-2*left, height: btnHeight))
        self.btnComplete.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#ffce54")), for: .normal)
        self.btnComplete.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#dcb34c")), for: .highlighted)
        self.btnComplete.setTitle("完成", for: .normal)
        self.btnComplete.setCornerRadius(radius: 20.0)
        self.btnComplete.titleLabel?.font = UIFont.LightDefaultFont(13.0)
        self.btnComplete.setTitleColor(UIColor.black, for: .normal)
        self.btnComplete.addTarget(self, action: #selector(btnCompleteClick), for: .touchUpInside)
        self.view.addSubview(self.btnComplete)
        
    }
    @objc fileprivate func btnCompleteClick(){
        _ = self.navigationController?.popToRootViewController(animated: true)
    }

}
